<?php

$params = require __DIR__ . '/params.php';
$db = require __DIR__ . '/db.php';

$config = [
    'id' => 'IoT',
    'basePath' => dirname(__DIR__),
    'language' => 'zh-CN',
    'timeZone' => 'Asia/Shanghai',
    'bootstrap' => ['log'],
    'controllerNamespace' => 'app\commands',
    'aliases' => [
        '@bower' => '@vendor/bower-asset',
        '@npm'   => '@vendor/npm-asset',
    ],
    'components' => [
        'cache' => [
            'class' => 'yii\caching\FileCache',
            'keyPrefix' => 'IoT_',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                    'logVars' => [
                        '_GET', '_POST', '_FILES', '_COOKIE', '_SESSION', '_SERVER',
                        '!_SERVER.CONTENT_TYPE',
                        '!_SERVER.DOCUMENT_ROOT',
                        '!_SERVER.DOCUMENT_URI',
                        '!_SERVER.FCGI_ROLE',
                        '!_SERVER.GATEWAY_INTERFACE',
                        '!_SERVER.HOME',
                        '!_SERVER.HTTP_ACCEPT',
                        '!_SERVER.HTTP_ACCEPT_ENCODING',
                        '!_SERVER.HTTP_CONNECTION',
                        '!_SERVER.HTTP_CONTENT_LENGTH',
                        '!_SERVER.HTTP_CONTENT_TYPE',
                        '!_SERVER.HTTP_HOST',
                        '!_SERVER.PATH_INFO',
                        '!_SERVER.PHP_SELF',
                        '!_SERVER.QUERY_STRING',
                        '!_SERVER.REDIRECT_STATUS',
                        '!_SERVER.REQUEST_SCHEME',
                        '!_SERVER.SCRIPT_FILENAME',
                        '!_SERVER.SCRIPT_NAME',
                        '!_SERVER.SERVER_ADDR',
                        '!_SERVER.SERVER_NAME',
                        '!_SERVER.SERVER_PORT',
                        '!_SERVER.SERVER_PROTOCOL',
                        '!_SERVER.SERVER_SOFTWARE',
                        '!_SERVER.USER',
                    ],
                ],
            ],
        ],
        'db' => $db,
        'authManager' => [
            'class' => 'app\models\RbacManager',
            'itemTable' => '{{%auth_item}}',
            'assignmentTable' => '{{%auth_assignment}}',
            'itemChildTable' => '{{%auth_item_child}}',
        ],
    ],
    'params' => $params,
];

if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
    ];
}

return $config;
